function Game(place)
{
    this.place=place;
    this.area=dom("TABLE",{"border":"1","align":"center"});
    this.prompt=dom("TABLE",{"align":"center"})
    addEventHandler(this.area,"click",
        function(e){
            e=e||event;
            var count=0;
            var tag=e.srcElement||e.target;
            if(tag.attributes[0].value!="Images/qi.png" && tag.name=="0" && tag.parentNode.bgColor=="black"){
                var id=tag.id.substr(4);
                var idhear=tag.id.substring(0,4);
                var arr=id.split("_");
                var h=Number(arr[0]);
                var w=Number(arr[1]);
                findzero(place,idhear,h,w);
                youwin(tag,count);
            }else if(tag.attributes[0].value!="Images/qi.png" && tag.name!="b" && tag.parentNode.bgColor=="black") youwin(tag,count);
            else if(tag.attributes[0].value!="Images/qi.png" && tag.name=="b" && tag.parentNode.bgColor=="black"){
                openall("area");
                tag.parentNode.bgColor="";
                tag.src="Images/db.png";
                stopcount();
                alert("你输了");
            }
        });
    place.style.backgroundColor="blanchedalmond";
    place.appendChild(dom("H1",{"align":"center"},"扫雷游戏"));
    var setlevel=dom("TABLE",{"border":"1","align":"center"},
             dom("TR",null,dom("TD",null,dom("FORM",{"name":"FORM1","method":"post","action":""},
             dom("INPUT",{"type":"radio","name":"level","value":"Level1","onclick":"docheck()"}),
             dom("FONT",null,"初级"),
             dom("INPUT",{"type":"radio","name":"level","value":"Level2","onclick":"docheck()"}),
             dom("FONT",null,"中级"),
             dom("INPUT",{"type":"radio","name":"level","value":"Level3","onclick":"docheck()"}),
             dom("FONT",null,"高级")
             ))));
    place.appendChild(setlevel);
}
Game.prototype.newgame=function(width,height,boomNum)
{
    stopcount();
    this.place.qicount=0;
    this.place.timecount=0;
    this.place.width=width;
    this.place.height=height;
    this.place.boomNum=boomNum;
    for(;this.prompt.hasChildNodes();)
    {this.prompt.removeChild(this.prompt.firstChild);}
    this.prompt.appendChild(dom("TR",null,dom("TD",null,"红旗:"),dom("TD",null,boomNum+"帜"),dom("TD",null,"计时:"),dom("TD",null,this.place.timecount+"秒")));
    var areaarr=generateplayarea(width,height,boomNum);
    for(;this.area.hasChildNodes();)
    {this.area.removeChild(this.area.firstChild);}
    beautifyarea(this.area,areaarr);
    timecount();
    this.place.appendChild(this.prompt);
    this.place.appendChild(this.area);

}